﻿using DXApplicationTangche.UC.有赞.Service;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplicationTangche.UC.有赞.有赞商品
{
    public partial class Form有赞SKU : DevExpress.XtraEditors.XtraForm
    {
        public Form有赞SKU()
        {
            InitializeComponent();
            this.刷新();
        }
        private void 刷新()
        {
            this.gridControl有赞SKU一览.DataSource = 有赞商品Service.getViewSpuCostList();
            this.gridView有赞SKU一览.RefreshData();
        }

        private void 更新有赞SKU信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                String itemId = this.gridView有赞SKU一览.GetRowCellValue(this.gridView有赞SKU一览.FocusedRowHandle, "itemId").ToString();
                String title = this.gridView有赞SKU一览.GetRowCellValue(this.gridView有赞SKU一览.FocusedRowHandle, "title").ToString();
                String detailUrl = this.gridView有赞SKU一览.GetRowCellValue(this.gridView有赞SKU一览.FocusedRowHandle, "detailUrl").ToString();
                new Form更新有赞SKU(itemId, title, detailUrl).ShowDialog();
                this.刷新();
            }
            catch 
            {
                return;
            }
        }

        private void simpleButton刷新_Click(object sender, EventArgs e)
        {
            this.刷新();
        }

        private void simpleButton同步有赞款式到数据库_Click(object sender, EventArgs e)
        {
            //  同步有赞款式到数据库——春衫定制
            有赞商品Service.saveYouzanSpuItemsAndSkusByGroup("2oluqykobnvyk", 216892094, "春衫定制");
            this.刷新();
        }
    }
}
